﻿namespace Cos.Core.NHibernate
{
    using log4net;

    using global::NHibernate;

    public abstract class RepositoryBase
    {
        protected ILog Logger;
        private readonly ISessionFactory _sessionFactory;
        
        protected RepositoryBase(ISessionFactory sessionFactory)
        {
            // get logger instance
            this.Logger = LogManager.GetLogger(this.GetType());

            // set session factory
            this._sessionFactory = sessionFactory;
        }

        public ISession CurrentSession
        {
            get { return _sessionFactory.GetCurrentSession(); }
        }
    }
}
